package Control; 
import java.*;
import java.sql.ResultSet;

import Entity.Job_Registration;
import Entity.Workshop_WorkshopEntity;
import Form.Job_RegistrationForm;
import Form.Workshop_CreateWorkshop_Form;

public class Job_Registration_Controller {

	private Job_Registration newJob = new Job_Registration();
	 
	private Job_RegistrationForm parser;

	public Job_Registration_Controller(Job_RegistrationForm parser) {
		setParser(parser);
	}

	public Job_RegistrationForm getParser() {
		return parser;
	}

	public void setParser(Job_RegistrationForm parser) {
		this.parser = parser;
	} 
	
	public void createJob(){ 
	
	newJob.setJobID(CommonControls.generateDefaultType5DigitCode('J'));
	newJob.setJobName(getParser().getJobName().getText()); 
	newJob.setJobDesc(getParser().getJobDesc().getText()); 
	newJob.setEducationCode((String)parser.getEdu_comboBox().getSelectedItem()); 
	newJob.setSalary((Double)getParser().getSalarySpinner().getValue()); 
	newJob.setNoSlots((Integer)getParser().getNoOfSlots().getValue()); 
	newJob.setDateCreated(CommonControls.getCurrentDate()); 
	newJob.setDateUpdated(CommonControls.getCurrentDate()); 
	newJob.setCategoryCode((String)parser.getCategory_Combo().getSelectedItem()); 
	newJob.setEmployerID(getParser().getEmployerID().getText()); 
	newJob.setJobStatusCode((String)parser.getStatusCombo().getSelectedItem());
	
	newJob.registerJob();
	}
}
